while i <= 9:
    a = 1
    while a <= i:
       print('{}X{}={:<2}'.format(a,i,a*i), end=' ')
         a += 1
         i += 1
    print()
print('-'*lines)


i = 9
while i <= 9 and i != 0:
    a = 1
    while a <= i:
        print('{}X{}={:<2}'.format(a,i,a*i), end=' ')
        a += 1
    i -= 1
    print()
print('-'*lines)


i = 1
while i <= 9:
  a = 9
   while a > 0:
       if a <= i:
            print('{}X{}={:<2}'.format(a, i, a * i), end=' ')
        else:
            print(' ' * 6, end=' ')
        a -= 1
    i += 1
    print()
print('-'*lines)

i = 9
while i > 0:
    a = 9
    while a > 0
        if a <= i:
            print('{}X{}={:<2}'.format(a, i, a * i), end=' ')
        else:
            print(' ' * 6, end=' ')
          a -= 1
    i -= 1
    # 只是为了换行
    print()
print('='*lines)



for i in range(1,10):
    for a in range(1,i+1):
        print('{}X{}={:<2}'.format(a,i,i*a),end=' ')
    print()
print('-'*lines)



for i in range(9,0,-1):
    for a in range(1,i+1):
        print('{}X{}={:<2}'.format(a, i, i * a), end=' ')
    print()
print('-'*lines)


for i in range(1,10):
    blank = ""
    for j in range(i,0,-1):
        blank += "{}X{}={:<3}".format(j,i,j*i)
    print ("{:>66}".format(blank))
print('-'*lines)


for i in range(9,0,-1):
    blank = ""
    for j in range(i,0,-1):
        blank += "{}X{}={:<3}".format(j,i,j*i)
    print ("{:>66}".format(blank))
print('='*lines)